{% extends "base.html" %}
{% load i18n %}
{% load promgen %}

{% block title %}
Promgen / Datasource / {{ shard.name }}
{% endblock %}

{% block content %}

<div class="page-header" v-pre>
  <h1>Datasource: {{ shard.name }}</h1>
  <a href="{{shard.url}}">{{shard.url}}</a>
</div>

{% breadcrumb shard %}

{% include 'promgen/shard_header.html' %}
{% regroup shard.project_set.all|dictsort:"service_id" by service as service_list %}

<table class="table table-bordered table-condensed">
  {% for service, project_list in service_list|dictsort:"grouper.name" %}

  <tr v-pre>
    <th colspan="4">
      <h2>
        <a href="{% url 'service-detail' service.id %}">{{ service.name }}</a>
        {% if service.owner %}
        <small class="pull-right">{% trans 'Contact' %}: {{service.owner.username}}</small>
        {% endif %}
      </h2>

    </th>
  </tr>

  <tr>
    <th class="col-md-2">Project</th>
    <th class="col-md-3">Exporters</th>
    <th class="col-md-3">Notifiers</th>
    <th class="col-md-1">Actions</th>
  </tr>
  {% for project in project_list %}
  {% include 'promgen/project_row.html' %}
  {% endfor %}

  {% endfor %}
</table>

{% endblock %}
